#ifndef TMGLOBALCTRL_H
#define TMGLOBALCTRL_H

#include <Ice/Ice.h>
#include <Glacier2/Glacier2.h>
#include <IceStorm/IceStorm.h>
#include "RobotDef.h"
#include <QDebug>
#include <QFileDialog>
#include <QThread>
#include <QMessageBox>

#include "dlgmain.h"
#include "dlglogin.h"

#define ROBOT_TTS_FILENAME "./Data/v5_tts.csv"

//extern Ice::CommunicatorPtr m_icePtr;
extern Robot::JsonPrx m_prxJson;
extern Robot::MotorPrx m_prxMotor;
extern Robot::AudioPrx m_prxAudio;
extern Robot::ScreenExPrx m_prxScreenEx;
extern Robot::ConfigPrx m_prxConfig;
extern Robot::PubPrx m_prxPub;
extern Robot::SessionPrx m_prxSession;
extern Robot::LivePrx m_prxLive;
extern Robot::ScriptPrx m_prxScript;
extern Robot::FileMgrPrx m_prxFileMgr;

//extern Ice::CommunicatorPtr m_iceSubPtr;
extern IceStorm::TopicManagerPrx m_topicManager;
extern Ice::ObjectPrx m_prxSub;


extern Glacier2::SessionFactoryHelperPtr _factory;
extern Glacier2::SessionHelperPtr _session;
extern Robot::SessionPrx _robotSession;

extern DlgMain* pr_DlgMain;
extern DlgLogin* pr_DlgLogin;

extern int conFlag;

//****是否开始Debug日志输出模式****s
#define DEBUG_MODEL

#ifdef DEBUG_MODEL

#include <QDebug>
#define QDEBUG_OUTPUT_INFO(debugInfo) \
qDebug()<<"debug: "<<debugInfo<<__FILE__<<",function:"<<__FUNCTION__<<",line:"<<__LINE__;
#endif

#ifndef DEBUG_MODEL
#define QDEBUG_OUTPUT_INFO(debugInfo)

#endif

#define BEGIN_CATCH                     \
    try{
#define END_CATCH(HintInfo)                       \
    }                                   \
    catch(const Ice::Exception &e)      \
    {                                   \
        qDebug()<<"*ICE ERR file:"<<__FILE__<<",function:"<<__FUNCTION__<<",line:"<<__LINE__;\
        qDebug()<<"*"<<e.what();             \
        emit signalICEException(e,HintInfo);\
        return false;  \
    };


#endif // TMGLOBALCTRL_H
